package com.winit.service.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.alibaba.dubbo.rpc.RpcContext;
import com.winit.core.service.ServiceB;

@Service(version = "${serviceB.service.version}",timeout=1000)
public class ServiceBImpl implements ServiceB {

    public String sayHallo(String name) {
        String attach = RpcContext.getContext().getAttachment("key");
        System.out.println("service B 获取dubbo上下文传参"+attach);
        
        double d = Math.random() * 10;
        if(d > 5) {
            throw new RuntimeException("exception");
        }
        return "hello form Service B " + name;
    }
}
